package com.woniuxy.controller;

import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.QiniuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;


/**
 * @author: 杜昊男  <br/>
 * Date: 2022/3/7:12:13  <br/>
 * Description:七牛云
 */

@RestController
public class QiniuController {
    /*
     * Description : 将数据存入七牛云
     * ChangeLog : 1. 创建 (2022/3/9 1:32 [10604]);
     ** @param 上传的文件
     * *  @return 七牛云存储该文件的地址
    */
    @Autowired
    private QiniuService qiniuService;
    @RequestMapping(value = "/UploadMedia", method = RequestMethod.POST)
    @ResponseBody
    @CrossOrigin
    @ApiOperation(value = "文件上传七牛云")
    public ResponseEntity uploadImage(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
        return qiniuService.upload(file, request);
    }
}